package com.whale.mapper;

import com.whale.entity.ReserveDetail;
import com.whale.entity.VenceOccupy;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface VenueOccupyMapper {

    /**
     * 查看所有占用场地详细
     * @return
     */
    @Select("select * from venue_occupy")
    List<VenceOccupy> getAllDetail();

    /**
     * 向场地占用表中插入多条数据
     * @param reserveDetailList
     */
    void insertBetch(List<ReserveDetail> reserveDetailList);

    @Delete("delete from venue_occupy where end_time<=#{time}")
    void deleteByEndTimeLT(LocalDateTime time);

    @Delete("delete from venue_occupy where reserve_id=#{id}")
    void deleteByReserveId(Long id);

    @Select("select venue_number,end_time,begin_time,type from venue_occupy")
    List<ReserveDetail> getDetaillsit();
}
